// 简化的性能配置文件
export const PERFORMANCE_CONFIG = {
    // 图片配置
    IMAGE: {
        QUALITY: 80,
        ENABLE_WEBP: true,
        CACHE_TIME: 3600,
        MAX_RETRIES: 3,
        LAZY_THRESHOLD: 0.1
    },

    // 请求配置
    REQUEST: {
        TIMEOUT: 10000,
        MAX_RETRIES: 2,
        RETRY_DELAY: 1000,
        CACHE_TIME: 300,
        CONCURRENT_LIMIT: 5
    },

    // 虚拟列表配置
    VIRTUAL_LIST: {
        ITEM_HEIGHT: 100,
        OVERSCAN: 5,
        CONTAINER_HEIGHT: 600
    },

    // 懒加载配置
    LAZY_LOAD: {
        THRESHOLD: 0.1,
        ROOT_MARGIN: '50px'
    },

    // 监控配置
    MONITOR: {
        ENABLE_FPS: import.meta.env.MODE === 'development',
        ENABLE_MEMORY: import.meta.env.MODE === 'development',
        REPORT_INTERVAL: 5000,
        FPS_THRESHOLD: 30,
        MEMORY_THRESHOLD: 100,
        LOAD_TIME_THRESHOLD: 3000
    }
}

// 获取环境配置
export const getEnvironmentConfig = () => {
    // #ifdef H5
    return { PLATFORM: 'h5', SUPPORT_WEBP: true }
    // #endif
    // #ifdef MP-WEIXIN
    return { PLATFORM: 'mp-weixin', SUPPORT_WEBP: false }
    // #endif
    // #ifdef APP-PLUS
    return { PLATFORM: 'app-plus', SUPPORT_WEBP: true }
    // #endif
    return { PLATFORM: 'unknown', SUPPORT_WEBP: false }
}

// 获取优化配置
export const getOptimizationConfig = () => {
    const envConfig = getEnvironmentConfig()
    return {
        ...PERFORMANCE_CONFIG,
        ...envConfig
    }
}

export default PERFORMANCE_CONFIG
